#include<iostream>
#include<vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> arr(n+1);
	for (int i = 1; i <= n; i++) {
		arr[i] = i;
	}
	int temp[200001];
	int a = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 2; j < 10; j++) {
			if(i!=j){
				if (i % j == 0) {
					a++;//��������
				}
			}
		}
		if (a == 0) {
			temp[i] = i;
		}
	}
	int tempr;
	for (int i = 2; i <= n; i++) {
		if(temp[i]=i){
			for (int j = n; j >= 2; j--) {
				if (temp[j] = j) {
					if (i == j)break;
					tempr = arr[i];
					arr[i] = arr[j];
					arr[j] = tempr;
					break;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << arr[i] << " ";
	}

	return 0;
}